<?php

namespace App\Domain\FamilyMember\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SetFamilyPost extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'id' => 'string|nullable',
            'name' => 'required_without:uid|string|nullable',
            'gender' => 'required_without:uid|string|nullable',
            'age' => 'required_without:uid|string|nullable',
            'idCard' => 'required_without:uid|string|nullable',
            'phone' => 'required_without:uid|string|nullable',
            'height' => 'required_without:uid|string|nullable',
            'weight' => 'required_without:uid|string|nullable',
            'relation' => 'required_without:uid|string|nullable',
        ];
    }

    public function messages()
    {
        return [
            'name.required' => '成员姓名必填',
            'gender.required' => '性别必选',
            'age.required' => '年龄必填',
            'idCard.required' => '身份证号必填',
            'phone.required' => '手机号必填',
            'height.required' => '身高必填',
            'weight.required' => '体重必填',
            'relation.required' => '与户主关系必选',

        ];
    }
}
